import java.util.Arrays;

public class Test {
    public static void main(String[] args) {
        int[] arr=new int[]{1,2,3,4,5,7,9,10};
        System.out.println("调整前该数组是"+Arrays.toString(arr));
        System.out.print("改变后：");
        num(arr);
    }
    public static void num(int[] arr) {
        int i = 0;
        int count1 = 0;
        int count2 = 0;
        for (i = 0; i < arr.length; i++) {
            if (arr[i] % 2 == 0) {
                count1++;
            }
            if (arr[i] % 2 != 0) {
                count2++;
            }
        }
        int f=count1;
        int e=count2;
        int[] n = new int[count1];
        int[] m = new int[count2];
        for (i = 0; i < arr.length; i++) {
            if (arr[i] % 2 == 0) {
                n[(count1)-1] = arr[i];
                count1--;
            } else {
                m[(count2)-1] = arr[i];
                count2--;
            }
        }
        System.out.print("[");
        count1=f;
        count2=e;
        for (i = 0; i < count2; i++) {
            if (i == 0) {
                System.out.print(m[i]);
            } else {
                System.out.print("," + m[i]);
            }
        }
        for (i = 0; i < count1; i++) {
                System.out.print("," + n[i]);
            }
        System.out.print("]");
    }
}
